const path = require('path');
const isDev = think.env === 'development';

module.exports = [
  {
    handle: 'meta',
    options: {
      logRequest: isDev,
      sendResponseTime: isDev,
    },
  },
  {
    handle: 'resource',
    enable: isDev,
    options: {
      root: path.join(think.ROOT_PATH, 'www'),
      publicPath: /^\/(static|uploads|favicon\.ico)/,
    },
  },
  {
    handle: 'trace',
    enable: !think.isCli,
    options: {
      debug: isDev,
    },
  },
  {
    handle: 'payload',
    options: {
      keepExtensions: true,
      limit: '5mb',
      uploadDir: path.join(think.ROOT_PATH, 'runtime\\temp'), //解决Windows下跨磁盘文件
    },
  },
  {
    handle: 'router',
    options: {},
  },
  {
    handle: 'framework',
    options: async() => {
      return {};
    },
  },
  {
    handle: 'ucpass',
    options: async() => {
      return {
        sid: '2712474cd5ebc0753909e43f968cf0ee', // 开发者账号id
        token: 'e95abf6189133e153cb5d9b6dcb484bf', // 开发者token
        appid: 'eff851143bf94fdf9ab8bd43c6f2abc6', // 应用id
        templateid: '88137', // 短信模板id
        uid: '', // 透传uid   可为空
      };
    },
  },
  'logic',
  'controller',
];
